package org.leaf.green.b2b

class AdjustmentDetail {

    Adjustment adjustment
    String serialNumber
    Product product
    BigDecimal quantity
    String unit
    BigDecimal amount

    static belongsTo = [adjustment : Adjustment]

    static constraints = {
        adjustment(nullable:false)
        serialNumber(nullable:false, blank:false, unique : 'adjustment', maxSize : 3)
        product(nullable:false)
        quantity(nullable:false, notEqual : new BigDecimal(0), scale : 2)
        unit(nullable:false, maxSize : 4)
        amount(nullable:false, notEqual : new BigDecimal(0), scale : 2)
    }

    static mapping = {
        table 'B2B_ADJUSTMENT_DETAIL'
    }
}
